
const app = getApp()
Page({
  data: {
    showRules:false,
    ruleDetail:'',
    box_list:[],
    pageNum:1,
    totalPage:0
  },
  onLoad() {
    wx.showShareMenu({
      withShareTicket: true,
    })
  },
  onShareTimeline() {
    return {
      title: '梦与玩',
      query: 'pages/forward/forward-index'
    }
  },
  onShareAppMessage() {
    return {
      title: '梦与玩'
    }
  },
  getBoxList(){
    let _this = this;
    app.util.request({
        url: "api/series/findLimit",
        method: "post",
        data: {
          page: _this.data.pageNum,
          pageSize:10,
          status: 2
      },
        success(response) {
            if (response.data.code == 0) {
                _this.setData({
                  totalPage:response.data.data.pages,
                   box_list:[..._this.data.box_list,...response.data.data.list]
                })
            }
        }
    })
  },
  toDetail(e){
    wx.navigateTo({
      url: '/pages/forward/forward-box/forward-box?id='+e.currentTarget.dataset.id,
    })
  },
  closeRules(){
    let that = this;
    that.setData({
      showRules:false
    })
  },
  openRules(){
    let _this = this;
    app.util.request({
      url: "api/notice/findposcard",
      method: "post",
      success(response) {
          if (response.data.code == 0) {
              _this.setData({
                showRules:true,
                 ruleDetail: response.data.data.details
              })
          }
      }
  })
  },
  onShow: function () {
    this.setData({
      box_list:[]
    })
    this.getBoxList()
  },
})
